package com.star.aries.utils.excel;

import com.alibaba.excel.write.handler.SheetWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
import org.apache.poi.ss.usermodel.Sheet;

public class FreezePaneHandler implements SheetWriteHandler {

  private static final int COL_SPLIT = 0;
  private static final int ROW_SPLIT = 1;
  private static final int LEFTMOST_COLUMN = 0;
  private static final int TOP_ROW = 1;

  @Override
  public void beforeSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {

  }

  @Override
  public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
    Sheet sheet = writeSheetHolder.getSheet();
    sheet.createFreezePane(COL_SPLIT, ROW_SPLIT, LEFTMOST_COLUMN, TOP_ROW);
  }

}
